<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-04 16:53:56
 * @LastEditTime: 2023-01-04 16:06:57
 * @LastEditors: sunkaiyuan sunkaiyuan@namenode.com
 * @Description: 
 */

namespace App\Http\Services\BaseData;

use App\Repositories\UnitRepository;
use App\Http\Services\Service;
use Illuminate\Support\Facades\DB;

class UnitService extends Service
    {
    public function boot(UnitRepository $repository)
        {
        $this->repository = $repository;
        }

    public function list()
        {

        $data = $this->repository->condition(request())->getGrid();
        return $data;
        }
    protected function save()
        {
        return $this->repository->autosave(request()->toArray());
        }
    protected function delete()
        {
        return $this->repository->whereIn("id", $this->getRequestIds())->get()->filter(function ($v)
            {
            $v->delete();
            });
        }
    }